﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ViewModels="clr-namespace:Beaker.OpenCube.WorldViewer.ViewModels"
		    xmlns:f="clr-namespace:Fluent;assembly=Fluent" 
                    xmlns:conv="clr-namespace:Beaker.OpenCube.Converters"
                    xmlns:ctrl="clr-namespace:Beaker.OpenCube.WorldViewer.Controls"
                    xmlns:wconv="clr-namespace:Beaker.OpenCube.WorldViewer.Converters">
    
	<DataTemplate DataType="{x:Type ViewModels:OpenWorldViewModel}">
		<ctrl:PopupDismissButton Background="{x:Null}" BorderBrush="{x:Null}" Margin="10" Padding="0" Command="{Binding OpenWorldCommand}">
			<Border Width="120" Height="120" Background="{StaticResource RibbonBackgoundBrush}" BorderThickness="1" BorderBrush="{StaticResource RibbonTopBorderBrush}">
				<Border.Resources>
					<BooleanToVisibilityConverter x:Key="BoolVisConverter" />
					<conv:BooleanConverter x:Key="InvBoolVisConverter" TrueValue="{x:Static Visibility.Collapsed}" FalseValue="{x:Static Visibility.Visible}" />
					<wconv:TimeToYCoordConverter x:Key="TimeToYCoordConverter" />
				</Border.Resources>
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="*" />
						<RowDefinition Height="38" />
					</Grid.RowDefinitions>
					<Border Grid.Row="0" Padding="10">
					</Border>
					<Canvas>
						<Path Canvas.Top="{Binding DayTime, Converter={StaticResource TimeToYCoordConverter}}"  Visibility="{Binding IsDay, Converter={StaticResource InvBoolVisConverter}}" Data="M20,7 A9.5,9.5 0 1 0 20,23 A9.5,9.5 0 0 1 20,7" StrokeThickness="1" Stroke="{StaticResource RibbonTopBorderBrush}" />
						<Ellipse Canvas.Top="{Binding DayTime, Converter={StaticResource TimeToYCoordConverter}}" Visibility="{Binding IsDay, Converter={StaticResource BoolVisConverter}}" Margin="5,5,93,55" Width="20" Height="20" StrokeThickness="1" Stroke="{StaticResource RibbonTopBorderBrush}" />
					</Canvas>
					<Path Visibility="{Binding IsFlat, Converter={StaticResource BoolVisConverter}}" Grid.RowSpan="2" Data="M-0.5,79.5 l119.5,0 l0,39.5 l-119.5,0z" Fill="#f0f0f0" StrokeThickness="1" Stroke="{StaticResource RibbonTopBorderBrush}" />
					<Path Visibility="{Binding IsFlat, Converter={StaticResource InvBoolVisConverter}}" Grid.RowSpan="2" Data="M-0.5,87.5 l20,-20 l10,-5 l20,20 l20,0 l10,-10 l10,-5 l10,-15 l10,2 L119.5,25 L119.5,119.5 L-0.5,119.5z" Fill="#f0f0f0" StrokeThickness="1" Stroke="{StaticResource RibbonTopBorderBrush}" />
					<Path Visibility="{Binding IsThundering, Converter={StaticResource BoolVisConverter}}" Data="M50.5,-0.5 l10,10l-8,5l-4,12l2,4l-4,6l0,10m6,-32l4,10l4,0m-4,0l1,4m-9,-2l-5,2l-2,4m2,-4l-6,-1" StrokeThickness="1" Stroke="{StaticResource RibbonTopBorderBrush}" />
					<Border Grid.Row="1" Padding="6,4" TextElement.Foreground="{StaticResource DefaultFontBrush}">
						<TextBlock Text="{Binding DisplayName}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis" />
					</Border>
				</Grid>
			</Border>
		</ctrl:PopupDismissButton>
	</DataTemplate>
	
</ResourceDictionary>